﻿using System;
using Microsoft.Xna.Framework;
using WindowsGame.Common.Interfaces;
using WindowsGame.Common.Static;

namespace WindowsGame.Common.Screens
{
	public class DemoScreen : BaseScreen, IScreen
	{
		private PlayType playType;

		public override void Initialize()
		{
			BackgroundColor = Color.Black;
			CurrScreen = ScreenType.Demo;
			playType = PlayType.Init;

		}

		public ScreenType Update(GameTime gameTime)
		{
			NextScreen = Update(ScreenType.Demo);
			if (CurrScreen != NextScreen)
			{
				return NextScreen;
			}

			if (PlayType.Start != playType)
			{
				Boolean start = MyGame.Manager.InputManager.Start();
				if (start)
				{
					playType = PlayType.Start;
				}
			}
			else if (PlayType.Start == playType)
			{
				Boolean start = MyGame.Manager.InputManager.Start();
				if (start)
				{
					playType = PlayType.Stop;
				}
			}

			Boolean reset = MyGame.Manager.InputManager.Reset();
			if (reset)
			{
				MyGame.Manager.SpriteManager.Reset();
				playType = PlayType.Reset;
			}

			if (PlayType.Start == playType)
			{
				MyGame.Manager.SpriteManager.Update(gameTime);
			}

			return ScreenType.Demo;
		}

		public override void Draw()
		{
			MyGame.Manager.BoardManager.Draw();
			MyGame.Manager.SpriteManager.Draw();
		}

	}
}